import config from 'config/config';
import request from 'utils/request';

let extendConfig = {

    //基础认证
    headers: {
        "authorization": config.appSecret,
        // "Content-Type": "multipart/form-data"
    }
};

const oauthApi = {

    //普通的用户账号密码登录
    login: params => request.post("/login", params), 

    //普通的快捷登录
    quickLogin: params => request.post("/smsLogin", params),
	
	//第三方登录
	oauthLogin: params => request.post("/thirdlogin/" + params.type + "/app/callback", params),
	
	//微信浏览器登录
	loginWechat: params => request.post("p/user/bindUserMobile/phone", params), 
	
	//微信浏览器绑定手机
	wechatQuickLogin: params => request.post("p/user/bindUserMobile", params), 
	// export const bindUserMobile = params => request.post('/p/user/bindUserMobile', params);
	
    //绑定手机号
    bindPhone: params => request.post("/bindPhone", params),

    //退出登录
    logout: params => request.post("/p/logout", params),

    //oauth2.0的账号密码登录, 微服务
    oauth2: params => request.post("/oauth/token", params, extendConfig),

    //oauth2.0的账号密码登录, 微服务
    quickOauth2: params => request.post("/oauth/token/quickToken", params, extendConfig),

    //oauth2.0, 刷新token, 微服务
    oauth2RefreshToken: params => request.post("/oauth/token/refreshToken", params, extendConfig),

    //oauth2退出登录
    oauth2Logout: params => request.post("/oauth/token/logout", params),

    // 获取用户是否需要设置资料
    needSetupInfo: (params) => request.get('/p/user/needSetupInfo', params),

    // 通过二维码绑定关系
    bindRelationshipByQRCode: params => request.post("/p/bindRelationshipByQRCode", params),

}

export default oauthApi;
